package cn.yudao.basic.controller;

import cn.yudao.basic.dto.ExitDto;
import cn.yudao.basic.exception.BusinessException;
import cn.yudao.basic.service.IExitService;
import cn.yudao.basic.utils.AjaxResult;
import cn.yudao.org.service.IEmployeeService;
import cn.yudao.user.service.IUserService;
import cn.yudao.user.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/exit")
public class ExitController {
    @Autowired
    private IExitService exitService;


    /**
    * @Title: exit
    * @Description: 账号退出
    * @Author: Mr.Jia
    * @Version: 1.0
    * @Date:  2022/7/8 22:52
    * @Parameters:
    * @Return
    */
    @PostMapping
    public AjaxResult exit(@RequestBody ExitDto exitDto){
        try {
            exitService.exit(exitDto);
            return AjaxResult.me();
        }catch (BusinessException e){
            e.printStackTrace();
            return AjaxResult.me().setSuccess(false).setMessage(e.getMessage());
        }catch (Exception e){
            e.printStackTrace();
            return AjaxResult.me().setSuccess(false).setMessage("系统繁忙");
        }
    }
}
